// 路由单独管理  管理业务相关
import Loadable from 'react-loadable'
import { Spin } from 'antd'
/* import ArtList from 'pages/ArtList'
import ArtAdd from 'pages/ArtAdd'
import ArtEdit from 'pages/ArtEdit'
import DashBoard from 'pages/DashBoard'
import Message from 'pages/Message'
import Settings from 'pages/Settings' */
/* const ArtList = Loadable({
  loader: ()=> import('pages/ArtList'),
  loading: Spin
}) */


import { 
  AreaChartOutlined,
  UnorderedListOutlined,
  MessageOutlined,
  SettingOutlined
} from '@ant-design/icons'

const ArtList = Loadable({
  loader: () => import('pages/ArtList'),
  loading: Spin,
})
// const ArtList = loadable('pages/ArtList')
const ArtAdd =  Loadable({
  loader: () => import('pages/ArtAdd'),
  loading: Spin
})
const ArtEdit =  Loadable({
  loader: () => import('pages/ArtEdit'),
  loading: Spin
})
const DashBoard =  Loadable({
  loader: () => import('pages/DashBoard'),
  loading: Spin
})
const Message =  Loadable({
  loader: () => import('pages/Message'),
  loading: Spin
})
const Settings =  Loadable({
  loader: () => import('pages/Settings'),
  loading: Spin
})
const NoPerssion =  Loadable({
  loader: () => import('pages/NoPerssion'),
  loading: Spin
})

const adminRoutes = [
  {
    path:'/admin/dashBoard',
    name:"仪表盘",
    component: DashBoard,
    icon: AreaChartOutlined,
    meta:{
      isNav:true,
      roles:['superAdmin','admin','a','b','c']// 当前路由可以访问的所有的角色
    }
  },
  {
    path:'/admin/artList',
    name:"文章列表",
    component: ArtList,
    icon: UnorderedListOutlined,
    meta:{
      isNav:true,
      roles:['superAdmin','admin','a','b','c']
    }
  },
  {
    path:'/admin/artAdd',
    name:"添加文章",
    component: ArtAdd,
    meta:{
      isNav:false,
      roles:['superAdmin','admin','a','b','c']
    }
  },
  {
    path:'/admin/artEdit/:artId',
    name:"编辑文章",
    component: ArtEdit,
    meta:{
      isNav:false,
      roles:['superAdmin','admin','a','b','c']
    }
  },
  {
    path:'/admin/msg',
    name:'消息中心',
    component: Message,
    icon:MessageOutlined,
    meta:{
      isNav:true,
      roles:['superAdmin','admin','a','b','c']
    }
  },
  {
    path:'/admin/settings',
    name:"设置",
    icon:SettingOutlined,
    component: Settings,
    meta:{
      isNav:true,
      roles:['superAdmin']
    }
  },
  {
    path:'/admin/noperssion',
    name:"没有权限",
    component: NoPerssion,
    meta:{
      isNav:false,
      roles:['superAdmin','admin','a','b','c']
    }
  },
]

export default adminRoutes